package indiwood.model.dao;

import indiwood.model.AwardVO;
import indiwood.model.CinemaVO;
import indiwood.model.DirectorVO;
import indiwood.model.MemberVO;
import indiwood.model.MovieVO;
import indiwood.model.ScheduleDateVO;
import indiwood.model.ScheduleTimeVO;
import indiwood.model.ShowingVO;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class AdminDAOImpl implements AdminDAO {
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;
	@Override
	public List<DirectorVO> getDirectorList(String pageNo) {
		return sqlSessionTemplate.selectList("admin.getDirectorList", pageNo);
	}
	@Override
	public int directorTotalContent() {
		return sqlSessionTemplate.selectOne("admin.directorTotalContent");
	}
	@Override
	public DirectorVO getDirectorContent(int no) {
		return sqlSessionTemplate.selectOne("admin.getDirectorContent", no);
	}
	@Override
	public List<MovieVO> getMovieListByDirectorNo(int no) {
		return sqlSessionTemplate.selectList("admin.getMovieListByDirectorNo", no);
	}
	@Override
	public List<String> getAwardList(int no) {
		return sqlSessionTemplate.selectList("admin.getAwardList", no);
	}
	@Override
	public void directorWrite(DirectorVO dvo) {
		sqlSessionTemplate.insert("admin.directorWrite", dvo);
	}
	@Override
	public void deleteAward(int no) {
		sqlSessionTemplate.delete("admin.deleteAward", no);
	}
	@Override
	public void deleteMovie(int no) {
		sqlSessionTemplate.delete("admin.deleteMovie", no);
	}
	@Override
	public void deleteMovieByDirectorNo(int no) {
		sqlSessionTemplate.delete("admin.deleteMovieByDirectorNo", no);
	}
	@Override
	public void deleteDirector(int no) {
		sqlSessionTemplate.delete("admin.deleteDirector", no);
	}
	@Override
	public List<DirectorVO> findAllDirector() {
		return sqlSessionTemplate.selectList("admin.findAllDirector");
	}
	@Override
	public void movieWrite(MovieVO mvo) {
		sqlSessionTemplate.insert("admin.movieWrite", mvo);
		
	}
	@Override
	public MovieVO movieContent(int no) {
		return sqlSessionTemplate.selectOne("admin.movieContent",no);
	}
	@Override
	public List<MovieVO> movieList(String pageNo) {
		return sqlSessionTemplate.selectList("admin.movieList",pageNo);
	}
	@Override
	public int movieTotalContent() {
		return sqlSessionTemplate.selectOne("admin.movieTotalContent");
	}
	@Override
	public void directorUpdate(DirectorVO dvo) {
		sqlSessionTemplate.update("admin.directorUpdate", dvo);
	}
	@Override
	public List<CinemaVO> getCinemaList(String pageNo) {
		return sqlSessionTemplate.selectList("admin.getCinemaList", pageNo);
	}
	@Override
	public int cinemaTotalContent() {
		return sqlSessionTemplate.selectOne("admin.cinemaTotalContent");
	}
	@Override
	public CinemaVO cinemaContent(int no) {
		return sqlSessionTemplate.selectOne("admin.cinemaContent", no);
	}
	@Override
	public void cinemaDelete(int no) {
		sqlSessionTemplate.delete("admin.cinemaDelete", no);
	}
	@Override
	public void cinemaUpdate(CinemaVO cvo) {
		sqlSessionTemplate.update("admin.cinemaUpdate", cvo);
	}
	@Override
	public void cinemaWrite(CinemaVO cvo) {
		sqlSessionTemplate.insert("admin.cinemaWrite", cvo);
	}
	@Override
	public void updateMovie(MovieVO mvo) {
		sqlSessionTemplate.update("admin.updateMovie", mvo);		
	}
	@Override
	public List<MemberVO> getMemberList(String pageNo) {
		return sqlSessionTemplate.selectList("admin.getMemberList",pageNo);
	}
	@Override
	public int getTotalMemberCount() {
		return sqlSessionTemplate.selectOne("admin.getTotalMemberCount");
	}
	@Override
	public void writeAward(AwardVO vo) {
		sqlSessionTemplate.insert("admin.writeAward", vo);
	}
	@Override
	public List<CinemaVO> getAllCinemaList() {
		return sqlSessionTemplate.selectList("admin.getAllCinemaList");
	}
	@Override
	public void showingWrite(ShowingVO svo) {
		sqlSessionTemplate.insert("admin.showingWrite", svo);
	}
	@Override
	public List<ShowingVO> getShowingList(int no) {
		return sqlSessionTemplate.selectList("admin.getShowingList", no);
	}
	@Override
	public void deleteShowing(int no) {
		sqlSessionTemplate.delete("admin.deleteShowing", no);
	}
	@Override
	public void deleteShowingByShowingNo(int showingNo) {
		sqlSessionTemplate.delete("admin.deleteShowingByShowingNo", showingNo);
	}
	@Override
	public List<String> getAllShowingMovieList(String pageNo) {
		return sqlSessionTemplate.selectList("admin.getAllShowingMovieList", pageNo);
	}
	@Override
	public List<MovieVO> getAllMovieList() {
		return sqlSessionTemplate.selectList("admin.getAllMovieList");
	}
	@Override
	public ShowingVO getShowingContent(int showingNo) {
		return sqlSessionTemplate.selectOne("admin.getShowingContent",showingNo);
	}
	@Override
	public List<ShowingVO> getShowingListByPage(String pageNo) {		
		return sqlSessionTemplate.selectList("admin.getShowingListByPage",pageNo);
	}
	@Override
	public int showingListTotalContent() {
		return sqlSessionTemplate.selectOne("admin.showingListTotalContent");
	}
	@Override
	public int getScheduleDate(int showingNo) {
		return sqlSessionTemplate.selectOne("admin.getScheduleDate", showingNo);
	}
	@Override
	public void updateSchedule(ShowingVO svo) {
		sqlSessionTemplate.update("admin.updateSchedule", svo);		
	}
	@Override
	public int confirmScheduleDateByShowingNo(ScheduleDateVO sdvo) {
		return sqlSessionTemplate.selectOne("admin.confirmScheduleDateByShowingNo", sdvo);
	}
	@Override
	public int confirmShowingContent(int movieNo) {
		return sqlSessionTemplate.selectOne("admin.confirmShowingContent",movieNo);
	}
	@Override
	public List<MovieVO> getExceptedMovieList() {
		return sqlSessionTemplate.selectList("admin.getExceptedMovieList");
	}
	@Override
	public void createScheduleDate(ScheduleDateVO sdvo) {
		sqlSessionTemplate.insert("admin.createScheduleDate", sdvo);		
	}
	@Override
	public void createScheduleTime(ScheduleTimeVO stvo) {
		sqlSessionTemplate.insert("admin.createScheduleTime", stvo);
	}
	@Override
	public int getDateNo(ScheduleDateVO sdvo) {
		return sqlSessionTemplate.selectOne("admin.getDateNo",sdvo);
	}
	@Override
	public List<ScheduleTimeVO> getScheduleByShowingNo(int showingNo) {
		return sqlSessionTemplate.selectList("admin.getScheduleByShowingNo", showingNo);
	}
}
